package com.example.springboot.mybatisplus.dal.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.springboot.mybatisplus.dal.entity.Emp;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author Lei Yu
 * @since 2024-05-17
 */
public interface EmpMapper extends BaseMapper<Emp> {

    default List<Emp> getEmpListByName(String ename) {
        // select * from emp;
        // select job from emp where ename = ?;
        LambdaQueryWrapper<Emp> wrapper = new LambdaQueryWrapper<>();
        // select job
        wrapper.select(Emp::getJob);
        // where ename = ?
        wrapper.eq(Emp::getEname, ename);
        return selectList(wrapper);
    }


}
